package com.cskaoyan.controller.wxcontroller;

import com.cskaoyan.bean.po.MarketTopic;
import com.cskaoyan.bean.common.BasePageInfo;
import com.cskaoyan.bean.common.BaseRespVo;
import com.cskaoyan.bean.common.CommonData;
import com.cskaoyan.bean.chaosbean.wxtopic.TopicWxVO;
import com.cskaoyan.service.wxservice.TopicWxService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author:J
 * @datetime 2023/1/1 19:29
 * @description: TODO:
 * vxtopic - list,detail,related
 */
@RestController
@RequestMapping("wx/topic")
public class TopicWeChatController {

    @Autowired
    TopicWxService topicWxService;

    /**
     * http://182.92.235.201:8083/wx/topic/list?page=1&limit=10
     * get
     *data: id picUrl price readCount subtitle title
     * @return
     */
    @RequestMapping("list")
    public BaseRespVo list(BasePageInfo info){

        CommonData<MarketTopic> data=topicWxService.list(info);
        return BaseRespVo.okYa(data);
    }

    /**
     *topic/detail 专题详情页
     * get
     * @param
     * @param id
     * @return
     */
    @RequestMapping("detail")
    public BaseRespVo detail(Integer id){

        TopicWxVO data=topicWxService.detail(id);
        return BaseRespVo.okYa(data);
    }

    /**
     * http://182.92.235.201:8083/wx/topic/related?id=368
     * get
     * @param
     * @param id
     * @return
     * 传入的info是否必要。
     */
    @RequestMapping("related")
    public BaseRespVo related(Integer id){
        //
        CommonData<MarketTopic> data=topicWxService.related(id);
        return BaseRespVo.okYa(data);
    }
}
